<html>
<head>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_ui/jquery_ui_latest.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/jquery_ender_weekplanner.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/defaultWeekPlannerController.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/weekplanner_utils.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/ender_neptuno/ender_neptuno.js"></script>

<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_uri/jquery_uri_latest.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_round_corners/jQuery.roundCorners-bc.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_round_corners/excanvas.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_wtooltip/wtooltip.min.js"></script>
<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_form/jquery.form.js"></script>

<script type="text/javascript" src="./jquery_ender_weekplanner/demo/libs/jquery_tooltips/jquery.timers-1.1.2.js"></script>

<script type="text/javascript">

	/**
	 * Loads the week events data
	 * @function RecibeDatos
	 **/
	function RecibeDatos()
	{
		/*
		 * Get data from a pregenerated json file.
		 */
		$.ajax({
			url: "./jquery_ender_weekplanner/demo/WeekEventsData.json",
			async : false,
			success:
				function(respuesta)
				{
					eval("var datos="+respuesta);
					$('#Planner').ParseaEventos(datos);
				}
		}); 
	}

	/**
	* Inits the single event data edition.
	* @function RecibeDatosEvento
	* @param {Integer} id
	*/
	function RecibeDatosEvento(id)
	{
		$.ajax({
			url: "./jquery_ender_weekplanner/demo/EventData.json",
			async : false,
			success:
				function(respuesta)
				{
					eval("var datos="+respuesta);
					
					var evento=null;
					
					for(i=0;i<datos.length;i++)
					{
						if(datos[i].id==id)
						{
							evento=datos[i];
						}
					}
					
					$('#Planner').EditaEvento(evento);
				}
		}); 
	}

	/**
	* @function GuardaDatosEvento
	* @param {EventObject} Evento
	*/
	function GuardaDatosEvento(Evento)
	{
		eval("var evento="+Evento);
	}

	/**
	 * @function CrearEvento
	 */
	function CrearEvento()
	{
	}

	$(document).ready( function()
	{ 
		$('#Planner').Planner(
		{
			onRequestFun:RecibeDatos,
			onRequestEditEvent:RecibeDatosEvento,
			onRequestCreateEvent:CrearEvento,
			cellWidth:100,
			cellHeight:40,
			controller: weekPlannerController,
			onReady: function a(){}
		 });
								 
		$('#Planner').seleccionaFecha('7/1/2010');
		RecibeDatos();

	});

</script>
	<link rel="stylesheet" href="./jquery_ender_weekplanner/demo/libs/jquery_ui/theme/ui.all.css" type="text/css" media="screen">
	<title>jquery weekplanner example</title>
</head>
<body>
	<h1>jquery weekplanner example</h1>
	<div style="float:left;width:80%;" id="Planner" />
</body>
</html>
